package com.sst.common.VO;

import com.sst.common.enums.ConfigDataSource;
import com.sst.common.enums.ConfigIdType;
import com.sst.common.enums.IdType;

public class ConfigGenerator {
    private String saveDir;

    private String entityPackage;

    private String mapperPackage;

    private String xmlPackage;

    private String servicePackage;

    private String serviceImplPackage;

    private String superServiceImpl;

    private String controllerPackage;

    /*
     * 指定生成表名
     */
    private String[] tableNames = null;

    /*
     * 是否覆盖当前路径下已有文件（默认 true）
     */
    private boolean fileOverride = true;

    /* db_config */
    private boolean dbPrefix = false;

    private String dbDriverName;

    private String dbUser;

    private String dbPassword;

    private String dbUrl;

    private IdType idType = null;

    private ConfigDataSource configDataSource = ConfigDataSource.MYSQL;

    private ConfigIdType configIdType = ConfigIdType.LONG;

    /*
     * 数据库字段是否为驼峰命名（默认 true）
     */
    private boolean isColumnHump = true;

    public String getControllerPackage() {
        return controllerPackage;
    }


    public void setControllerPackage(String controllerPackage) {
        this.controllerPackage = controllerPackage;
    }

    public String getSaveDir() {
        return saveDir;
    }


    public void setSaveDir( String saveDir ) {
        this.saveDir = saveDir;
    }


    public String getEntityPackage() {
        return entityPackage;
    }


    public void setEntityPackage( String entityPackage ) {
        this.entityPackage = entityPackage;
    }


    public String getMapperPackage() {
        return mapperPackage;
    }


    public void setMapperPackage( String mapperPackage ) {
        this.mapperPackage = mapperPackage;
    }


    public String getServicePackage() {
        return servicePackage;
    }


    public void setServicePackage( String servicePackage ) {
        this.servicePackage = servicePackage;
    }


    public String getSuperServiceImpl() {
        if ( superServiceImpl == null || "".equals(superServiceImpl) ) {
            if ( this.getConfigIdType() == ConfigIdType.STRING ) {
                return "com.baomidou.framework.service.impl.CommonServiceImpl";
            } else {
                return "com.baomidou.framework.service.impl.SuperServiceImpl";
            }
        }
        return superServiceImpl;
    }


    public void setSuperServiceImpl( String superServiceImpl ) {
        this.superServiceImpl = superServiceImpl;
    }


    public boolean isDbPrefix() {
        return dbPrefix;
    }


    public void setDbPrefix( boolean dbPrefix ) {
        this.dbPrefix = dbPrefix;
    }


    public String getDbDriverName() {
        return dbDriverName;
    }


    public void setDbDriverName( String dbDriverName ) {
        this.dbDriverName = dbDriverName;
    }


    public String getDbUser() {
        return dbUser;
    }


    public void setDbUser( String dbUser ) {
        this.dbUser = dbUser;
    }


    public String getDbPassword() {
        return dbPassword;
    }


    public void setDbPassword( String dbPassword ) {
        this.dbPassword = dbPassword;
    }


    public String getDbUrl() {
        return dbUrl;
    }


    public void setDbUrl( String dbUrl ) {
        this.dbUrl = dbUrl;
    }


    public IdType getIdType() {
        return idType;
    }


    public void setIdType( IdType idType ) {
        this.idType = idType;
    }


    public boolean isColumnHump() {
        return isColumnHump;
    }


    public void setColumnHump( boolean isColumnHump ) {
        this.isColumnHump = isColumnHump;
    }


    public ConfigDataSource getConfigDataSource() {
        return configDataSource;
    }


    public void setConfigDataSource( ConfigDataSource configDataSource ) {
        this.configDataSource = configDataSource;
    }


    public ConfigIdType getConfigIdType() {
        return configIdType;
    }


    public void setConfigIdType( ConfigIdType configIdType ) {
        this.configIdType = configIdType;
    }

    public String getXmlPackage() {
        if (null == xmlPackage || "".equals(xmlPackage)) {
            xmlPackage = mapperPackage + ".xml";
        }
        return xmlPackage;
    }

    public void setXmlPackage(String xmlPackage) {
        this.xmlPackage = xmlPackage;
    }

    public String[] getTableNames() {
        return tableNames;
    }

    public void setTableNames( String[] tableNames ) {
        this.tableNames = tableNames;
    }

    public boolean isFileOverride() {
        return fileOverride;
    }

    public void setFileOverride(boolean fileOverride) {
        this.fileOverride = fileOverride;
    }

    public String getServiceImplPackage() {
        if (null == serviceImplPackage || "".equals(serviceImplPackage)) {
            serviceImplPackage = servicePackage + ".impl";
        }
        return serviceImplPackage;
    }

    public void setServiceImplPackage(String serviceImplPackage) {
        this.serviceImplPackage = serviceImplPackage;
    }
}
